﻿using System.Collections.Generic;

namespace PaceR.Core.Interfaces
{
    /// <summary>
    /// Results of an operation on a specific type
    /// </summary>
    /// <typeparam name="T">The type of the entity worked on</typeparam>
    public interface IResult<T>
    {
        /// <summary>
        /// The entity worked on
        /// </summary>
        T Entity { get; }
        /// <summary>
        /// A collection of entities worked on
        /// </summary>
        IEnumerable<T> Entities { get; }
        /// <summary>
        /// A set of messages returned by the operation
        /// </summary>
        IResultMessages Messages { get; }

        /// <summary>
        /// set the entities that were worked on
        /// </summary>
        /// <param name="entities"></param>
        void SetResultEntities(params T[] entities);

        /// <summary>
        /// set the entities that were worked on
        /// </summary>
        /// <param name="entities"></param>
        void SetResultEntities(IEnumerable<T> entities);

        /// <summary>
        /// Merge data from another result set with this result set
        /// </summary>
        /// <param name="newResult">new result set</param>
        void MergeResults(IResult<T> newResult);
    }
}
